<template>
    <div>
        <div class="qr_page">
            <div class="screen_left">
                <div class="wrapper">
                    <img class="bg1" src="../../assets/login/logo_01.png"/>
                    <img class="bg1" src="../../assets/login/logo1.png"/>
                </div>
                <div class="qr_wrap">
                        <img src="../../assets/web/kaike.jpg" alt="" class="qr--image">
                </div>
            </div>
            <div class="screen_right">
                <div class="selectPostionExit" @click="exitBtn">
                    <i class="iconfont iconfontExit">&#xe61d;</i>退出登录
                </div>
                
                <div class="selectposition">
                    <div @click="gotoIdeAZ">
                        <div id="az" class="az">
                            <p class="positionName">AZ</p>
                            <p class="positionDescript">代维一线安装岗工人</p>
                            <p class="positionPrompt" v-show="flagAZ">正在进行中</p>
                        </div>
                    </div>
                    <div @click="gotoIdeFAZ">
                        <div class="noAz">
                            <p class="positionName">非AZ</p>
                            <p class="positionDescript">员工性质为JH、LS、支撑岗位等</p>
                            <p class="positionPrompt" v-show="flagFAZ">正在进行中</p>
                        </div>  
                    </div>
                </div>
              
            </div>
        </div>
    </div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
  data() {
    return {
      msg: "没毛病",
      zz: "好吧",
      flagAZ: false,
      flagFAZ: false
    };
  },
  methods: {
    gotoIdeAZ: function() {
      // localStorage.setItem("isaz", 0);
      this.$store.commit('selects',0);
      if (this.flagAZ == false) {
        var isaz = { az: "AZ"};
        var url = "/OpenCourse";
        this.$axios
          .post(url, isaz)
          .then(Json => {
            this.$router.push("selectCourse");
          })
          .catch(error => {
            this.$message("课程日期插入失败！请联系管理员");
          });
      } else {
        this.$router.push("selectCourse");
      }
    },
    gotoIdeFAZ: function() {
      // localStorage.setItem("isaz", 1);
      this.$store.commit('selects',1);
      if (this.flagFAZ == false) {
        var isaz = { az: "FAZ" };
        var url = "/OpenCourse";
        this.$axios
          .post(url, isaz)
          .then(Json => {
            this.$router.push("selectCourse");
          })
          .catch(error => {
            this.$message("课程日期插入失败！请联系管理员");
          });
      } else {
        this.$router.push("selectCourse");
      }
    },
    getInitData: function() {
      var url = "/OpenCourse";
      this.$axios
        .get(url, {})
        .then(Json => {
          if (Json.data == "loginout") {
            this.$message({
              type: "info",
              message: "登录信息失效，请重新登录！"
            });
            this.$router.push("/login");
          } else {
            if (Json.data[0] != "0") {
              this.flagAZ = true;
            }
            if (Json.data[1] != "0") {
              this.flagFAZ = true;
            }
          }
        })
        .catch(error => {
          this.$message("获取开课信息失败！请联系管理员");
        });
    },
    //退出登录
    exitBtn(){
       this.$confirm("确定要退出登录吗?", "提示").then(() => {
        //数据清理
        // window.localStorage.clear() 
        this.$router.push("/login");
      });
    }
  },
  mounted() { 
    this.getInitData();
  }
};
</script>

<style scoped>
.selectPostionExit{
    position: absolute;
    top: 55px;
    right: 80px;
    cursor: pointer;
    color: #a0a0a0;
}
@font-face {
  font-family: 'iconfont';  /* project id 1514769 */
  src: url('//at.alicdn.com/t/font_1514769_609mf11ldzw.eot');
  src: url('//at.alicdn.com/t/font_1514769_609mf11ldzw.eot?#iefix') format('embedded-opentype'),
  url('//at.alicdn.com/t/font_1514769_609mf11ldzw.woff2') format('woff2'),
  url('//at.alicdn.com/t/font_1514769_609mf11ldzw.woff') format('woff'),
  url('//at.alicdn.com/t/font_1514769_609mf11ldzw.ttf') format('truetype'),
  url('//at.alicdn.com/t/font_1514769_609mf11ldzw.svg#iconfont') format('svg');
}
.iconfontExit {
  font-family: "iconfont" !important;
  font-size: 22px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #a0a0a0;
  vertical-align: middle;
}
.selectPostionExit:hover{
  color:#639ef4;
}
.selectPostionExit:hover .iconfontExit{
  color:#639ef4;
}

.qr_page {
  z-index: 2;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: #fff;
  /* border: 1px solid orange; */
}

.screen_left {
  flex: 1;
  height: 100%;
  /* border: 1px solid red; */
}

.wrapper {
  margin-left: 10%;
  margin-top: 50px;
}
.wrapper .bg1 {
  vertical-align: middle;
}
.qr_wrap {
  flex-direction: column;
  padding-top: 80px;
}
.qr--image {
  display: block;
  margin: 5% auto;
}

.screen_right {
  position: relative;
  width: 500px;
  height: 100%;
  /* background: #639EF4;
    border: 1px solid green; */
}
.selectposition {
  color: white;
  font-size: 25px;
  margin: 35% auto;
}
.az,
.noAz {
  border: 1px solid white;
  width: 280px;
  text-align: center;
  height: 152px;
  cursor: pointer;
  background: #639ef4;
  color: white;
  border-radius: 10px;
}
.az {
  margin-bottom: 120px;
}
.az:hover,
.noAz:hover {
  background: #73d25a;
}
.positionName {
  font-weight: 600;
}
.positionDescript {
  font-size: 16px;
}
.positionPrompt {
  font-size: 16px;
  color: #9f5000;
}
a {
  text-decoration: none;
}
</style>

